<?php
namespace modules\welcome;
use \modules\auth\api as auth;
use \phiction\exceptions\redirect;

class page
{
    static function mapping()
    {
        return [
            '/' => 'welcome',
        ];
    }

    static function welcome($q, $html, &$args)
    {
        if (!is_null(auth::login_status($q, $args)))
            throw new redirect("/dashboard");

        $args['SUBTITLE'] = "欢迎";
        $args['BLANK_BODY'] = true;
        return $html->mark([ 'div', 'class' => 'welcome',
            [ 'div', 'class' => 'cover',
                [ 'div', 'class' => 'main',
                    [ 'div', 'class' => 'beta', "公测版" ],
                    [ 'div', 'class' => 'title',
                        [ 'div', 'class' => 'title-text', "CRM Lite" ],
                        [ 'div', 'class' => 'description', "轻量级 CRM 系统" ],
                        [ 'div', 'class' => 'beta-footnote', "免费公测！无限制，不删号！" ],
                    ],
                ],
                [ 'aside',
                    [ 'div', 'class' => 'actions',
                        [ 'button', 'class' => 'register', 'data-href' => '/auth/register', "马上注册" ],
                        [ 'a', 'class' => 'login', 'href' => '/auth/login', "登录" ],
                    ],
                ]
            ],
            [ 'footer',
                [ 'div', "(C) 李强组, 2016." ]
            ],
        ]);
    }
}

